<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'search.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="JS/jquery-1.8.3.js"></script>
	<script>
	   $(function(){
		   $("#sub").unbind("click").bind("click",function(){
				var infoId=$("input[name=infoId]").val();
				var replycount=$("input[name=replycount]").val();
				var reporttime=$(".p1").html();
				var content=$("#content").val();
				
				if(content==""){
					alert("内容不能为空");
				}else{
					$.ajax({
						url:"AddServlet",
						type:"post",
						data:{"infoId":infoId,"replycount":replycount,"reporttime":reporttime,"content":content},
						dataType:"html",
						success:function(result){
							$("#aa").html(result);
						}
					});
				}
		   });
	   });
	</script>
  </head>
  
  <body>
    	<input type="hidden" name="infoId" value="${info.id }">
    	<input type="hidden" name="replycount" value="${info.replycount }">
    	<h3>${info.title }</h3>
    	<p class="p1">${info.reporttime }</p>
    	<p class="p2">${info.content }</p>
    	<p>读者回应</p>
    	<c:forEach var="r" items="${rList }">
    	  <p>发表于：${r.replytime }</p>
    	  <p>${r.content }</p>
    	</c:forEach>
    	<div id="aa"></div>
    	<p>快速回复（字数200字以内）</p>
    	<textarea cols="40" rows="3" maxlength= "200" id="content" name="content"></textarea><br/>
    	<input type="button" id="sub" value="提交"><a href="ShowInfoServlet">返回首页</a>

  </body>
</html>
